const UserInfoReducer = (prevState = {
  token: "",
  userInfo: {},
  menus: []
}, action = {}) => {
  const newState = {...prevState};
  switch (action.type) {
    case "SET_USERINFO":
      newState.token = action.value.token;
      newState.userInfo = action.value.userInfo;
      newState.menus = action.value.menus;
      return newState;
    case "CLEAR_USERINFO":
      newState.token = "";
      newState.userInfo = {};
      newState.menus = [];
      return newState;
    default:
      return prevState;
  }
}

export default UserInfoReducer